<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<x:parse xml="${param.xmlstr}" var="xmlData" />
<div class="t_bar">
	<span class="color_red">*</span>合作社成员基本情况
</div>
	<table  id="tblCooperation" border="0" cellspacing="0" cellpadding="0" class="table01" >
		<thead>
			<tr>
                <th width="5%" align="center">选择</th>
                <th width="5%" align="center">序号</th>
				<th width="20%" align="center">成员姓名或名称</th>
				<th width="11%" align="center">出资额（万元）</th>
				<th width="12%" align="center">出资方式</th>
				<th width="12%" align="center">证件类型</th>
				<th width="15%" align="center">证件号码</th>
				<th width="20%" align="center">住所</th>
			</tr>
		<tbody id="tab">
					<tr style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name=selCooperation >
						</td>
						<td align="center">&nbsp;
							<span name="cooperations|cooperation[0]@seq_no" >[index]</span> 
						</td>
						<td>
							<input type="text" name="cooperations|cooperation[0]|name"  class=" input_text required" maxlength="50" style="width:80%" label="成员姓名或名称"/>
						</td>
						<td>
							<input type="text" name="cooperations|cooperation[0]|contributive"  label="出资额" onfocus="InitInput.setNumber(this,7,4,2)" style="text-align:right;width:80%" class="input_text required" />
						</td> 
						<td>
							<input type="text" name="cooperations|cooperation[0]|investment_type" label="出资方式"  maxlength="50"  style="width:80%" class="input_text required" />
						</td> 
						<td>
						    <cpt:select id="id_type_[index]" name="id_type" key="id_type"  onChange="initControlValue(this.id);setIdNoCheck(this.id);" value="" className="common_select"></cpt:select>
				            <input type="hidden" name="cooperations|cooperation[0]|id_type_value" value="" class="required" label="证件类型"/>
				            <input type="hidden" name="cooperations|cooperation[0]|id_type_name" value=""/>
						</td> 
						<td>
							<input type="text" name="cooperations|cooperation[0]|id_no"  label="证件号码" maxlength="50"  style="width:80%" class="input_text required" />
						</td> 
						<td>
							<input type="text" name="cooperations|cooperation[0]|residence"  label="住所" maxlength="50" style="width:80%" class="input_text required" />
						</td> 
					</tr>
					
					<c:set value="0" var="index" scope="page"/>
					<x:forEach select="$xmlData/data/cooperations/cooperation" var="cooperation">
					
					<c:choose>
						<c:when test="${index<10}" ><c:set value="0" var="flag" scope="page"/></c:when>
						<c:otherwise><c:set value="" var="flag" scope="page"/></c:otherwise>
					</c:choose>
					<tr >
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selCooperation" >
						</td>
						<td align="center">&nbsp;
							<span name="cooperations/cooperation[${flag}${index}]@seq_no" ><x:out select="$cooperation/@seq_no"/></span> 
						</td>
						<td>
							<input type="text" name="cooperations/cooperation[${flag}${index}]/name"   style="width:80%"   class=" input_text required" value="<x:out select="$cooperation/name"/>" label="成员姓名或名称" maxlength="50"/>
						</td>
						<td >
							<input type="text" name="cooperations/cooperation[${flag}${index}]/contributive"  onfocus="InitInput.setNumber(this,7,4,2)"   label="出资额" style="text-align:right;width:80%"  class=" input_text required" value="<x:out select="$cooperation/contributive" />"/>
						</td> 
						<td >
							<input type="text" name="cooperations/cooperation[${flag}${index}]/investment_type" style="width:80%"  class=" input_text required" value="<x:out select="$cooperation/investment_type"/>" label="出资方式" maxlength="50"/>
						</td> 
						<td >
						    <c:set var="id_type_value"><x:out select="$cooperation/id_type_value"/></c:set>
							<cpt:select id="id_type_${index}" name="id_type" key="id_type"  onChange="initControlValue(this.id);setIdNoCheck(this.id);" value="${id_type_value }" className="common_select"></cpt:select>
				            <input type="hidden" name="cooperations/cooperation[${flag}${index}]/id_type_value" value="<x:out select="$cooperation/id_type_value"/>" class="required" label="证件类型"/>
				            <input type="hidden" name="cooperations/cooperation[${flag}${index}]/id_type_name" value="<x:out select="$cooperation/id_type_name"/>"/>
						</td> 
						<td >
							<input type="text" name="cooperations/cooperation[${flag}${index}]/id_no" style="width:80%"  class=" input_text required" value="<x:out select="$cooperation/id_no"/>" label="证件号码" maxlength="50"/>
						</td> 
						<td >
							<input type="text" name="cooperations/cooperation[${flag}${index}]/residence" style="width:80%"  class=" input_text required" value="<x:out select="$cooperation/residence"/>" label="住所" maxlength="50"/>
						</td> 
					</tr>
					<c:set value="${index+1}" var="index" scope="page"/>
					</x:forEach>
					
				</tbody>
					</table>
					<table width="98%" align="center">
					<tr ><td>
					<input class="button" name="cmdAddbefore" type=button value="添加" onclick="addNewRow('tblCooperation');try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblCooperation','selCooperation')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblCooperation','selCooperation')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblCooperation','合作社成员');">
					</td></tr>
	</table>
	<table  id="tal" border="0" cellspacing="0" cellpadding="0" class="table01 t_css" >
	<tr>
	<td align="right" colspan="3" width="30%">成员总数（名）:</td>
	<td colspan="5" width="70%"><input type="text" name="proposal/total_member" onchange="setTotalPre();" id="total_member" label="成员总数" class="input_css required valueGreatEqual:total_member:peasant_member" style="text-align: right" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/proposal/total_member"/>" /></td>
	</tr>
	<tr>
	<td align="right" colspan="3" width="30%">农民成员（名）:</td>
	<td colspan="2" width="23%"><input type="text" name="proposal/peasant_member" onchange="setTotalPre();"  id="peasant_member" label="农民成员" class="input_css required " style="text-align: right" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/proposal/peasant_member"/>" /></td>
	<td align="right" width="12%">所占比例（%）:</td>
	<td colspan="2" width="35%"><input type="text" name="proposal/peasant_member_pre" id="peasant_member_pre" label="农民成员所占比例" class="input_css gray " disabled style="text-align: right" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/proposal/peasant_member_pre"/>" /></td>
	</tr>
	<tr>
	<td align="right" colspan="3">企业、事业单位或社会团体成员（名）:</td>
	<td colspan="2"><input type="text" name="proposal/other_member" id="other_member" onchange="setTotalPre();"  label="企业、事业单位或社会团体成员" class="input_css required valueGreatEqual:total_member:other_member" style="text-align: right" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/proposal/other_member"/>" /></td>
	<td align="right" >所占比例（%）:</td>
	<td colspan="2"><input type="text" name="proposal/other_member_pre" id="other_member_pre" label="企业、事业单位或社会团体成员所占比例" class="input_css gray " disabled style="text-align: right" onfocus="InitInput.setNumber(this,9,0,0)" value="<x:out select="$xmlData/data/proposal/other_member_pre"/>" /></td>
	</tr>
	</table>
	
	
	<script type="text/javascript">
	$(function(){
		$("#tblCooperation").find("select").each(function(){
			setIdNoCheck($(this).attr("id"));
		});
	});
	function setIdNoCheck(idTypeSelectId) {
		var parentTd = $("#"+idTypeSelectId).parent("td");
		var id_type_value = parentTd.find("input[name$='id_type_value']").val();
		var idNo = parentTd.next("td").find("input[name$='id_no']");
		if (id_type_value == 1) {
			idNo.addClass("idCard");
		} else {
			idNo.removeClass("idCard");
		}
	}
	
	function setTotalPre(){
		var total_member = $("#total_member").val();
		var peasant_member = $("#peasant_member").val();
		var other_member =$("#other_member").val();
		if(total_member==0 || total_member==''){
			$("#peasant_member_pre").val("0.00");
			$("#other_member_pre").val("0.00");
		}else{
			$("#peasant_member_pre").val(formatVal(peasant_member*100/total_member));
			$("#other_member_pre").val(formatVal(other_member*100/total_member));
		}
	}
   </script>
